﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=1">
    <meta name="format-detection" content="telephone=no">
    <meta charset="UTF-8">
    <title>非常实用的计算属性computed实例</title>
    <link href="../css/bootstrap.css"/>
    <link href="../css/bootstrap-theme.css"/>
</head>
<body>
    <h1>非常实用的计算属性computed实例</h1><br/>

    <div id="app">
        <input v-model="n"/> + <input v-model="n2"/> = <input v-model="sum"/>
    </div>
<script src="../js/jquery-2.2.0.min.js"></script>
<script src="../js/vue-2.5.16.js"></script>

<script>
    var app = new Vue({
        el:'#app',
        computed:{
            sum:function(){
                return this.n*1+this.n2*1;
            }
        },
        data:{
            name:'模版数据',
            n:1,
            n2:2
        }
    });
</script>

</body>
</html>